package by.ostrovsky.webhousingsystem.controller.taskgroup;

import java.util.LinkedList;
import java.util.List;

import org.apache.log4j.Logger;

import by.ostrovsky.webhousingsystem.controller.IOperateController;
import by.ostrovsky.webhousingsystem.dao.DAOFactory;
import by.ostrovsky.webhousingsystem.dao.implementation.idao.IReadDAO;
import by.ostrovsky.webhousingsystem.exception.CommonException;
import by.ostrovsky.webhousingsystem.hibernate.entity.TaskGroup;

public class GetTaskGroupController implements IOperateController<TaskGroup, Boolean>{
	private static Logger logger = Logger
			.getLogger(GetTaskGroupController.class);

	@Override
	public List<TaskGroup> get() {
		List<TaskGroup> list = new LinkedList<TaskGroup>();
		try {
			DAOFactory factory = DAOFactory.getDAOFactory(DAOFactory.MySQL);
			IReadDAO<TaskGroup> dao = factory.getReadTaskGroupDAO();
			
			list.addAll(dao.readAll());
		} catch (Exception e) {
			logger.error(e);
		}
		return list;
	}

	@Override
	public Boolean set(List<TaskGroup> list) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean delete(List<TaskGroup> list) throws CommonException {
		// TODO Auto-generated method stub
		return null;
	}
}
